<?php

class ProductInfo
{
    public $name;
    public $shortName;
    public $version;
    public $build;
    public $url;
    public $size;
    public $url_x64;
    public $size_x64;
    public $date;
    public $file;
    public $file_x64;
    public $language;
    public $zipUrl;
    public $zip;
    
    
    public function Parse( XPathHelper $helper )
    {
        $this->name         = $helper->GetText("Name");
        $this->shortName    = $helper->GetText("ShortName");
        $this->version      = $helper->GetText("Version");
        $this->build        = $helper->GetText("Build");
        $this->url          = $helper->GetText("URL");
        $this->size         = $helper->GetText("Size");
        $this->url_x64      = $helper->GetText("URL_x64");
        $this->size_x64     = $helper->GetText("Size_x64");
        $this->date         = $helper->GetText("Date");
        $this->file         = Util::GetFilename($this->url);
        $this->file_x64     = Util::GetFilename($this->url_x64);
        $this->language     = $helper->GetText("Language");
        $this->zipUrl       = self::changeExtensionToZip($this->url);
        $this->zip          = Util::GetFilename($this->zipUrl);
    }
    
    private function changeExtensionToZip($url)
    {
    	return preg_replace("/\.\w{3,3}$/i", ".zip", $url);
    }
}

?>
